package com.co.recommend.conf;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {


    @Bean("queue")
    public Queue queue(){
        return  new Queue("subVideo");
    }

    @Bean("pubVideo")
    public Exchange pubVideoExchange(){
        return ExchangeBuilder.fanoutExchange("pubVideo").durable(true).build();
    }

    @Bean
    public Binding searchAddQueueBinding(@Qualifier("queue") Queue queue,
                                         @Qualifier("pubVideo") Exchange exchange){
        return BindingBuilder.bind(queue).to(exchange).with("").noargs();
    }
}
